<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/pear/component/layui/css/layui.css">
    <link rel="stylesheet" href="/pear/component/pear/css/pear.css" />
    <script src="/pear/component/layui/layui.js"></script>
</head>
<body>
nihap
<table  id="demo" lay-filter="demo"></table>
<script src="/pear/component/layui/layui.js"></script>
<script src="/pear/component/pear/pear.js"></script>
<script>
    layui.use('table', function(){
        var table = layui.table,
            layer = layui.layer,
            $ = layui.jquery;
        table.render({
            elem: '#demo'
            ,url: '/record/getRecord' //数据接口
            ,skin: 'line'
            ,cols: [
                [ //表头
                    {field: 'name', title: '用户名', width:80}
                    ,{field: 'reTime', title: '服务类型', width:100}
                    ,{field: 'Remarks', title: '服务日期', width:120}
                ]
            ]
        });

        table.on('edit(demo)', function(obj){
            console.log(obj);
            var value = obj.value //得到修改后的值
                ,data = obj.data //得到所在行所有键值
                ,field = obj.field; //得到字段
            console.log("$$$$$$$$$");
            console.log("value:",value);
            console.log("data:",data);
            console.log("field:",field);
            console.log(data.Id);
            $.ajax({
                url:'/apply/updateRemark',
                data:{"remark":value,"Id":data.Id},
                success:function (data) {
                    console.log(data.info);
                    if (data.info == '修改成功'){
                        layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改为：'+ value);
                    }else {
                        layer.msg("修改失败");
                    }
                }
            })
        });
    });
</script>
</body>
</html>